package com.beauty.order.client;

import com.beauty.order.result.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 库存服务客户端接口，通过 Feign 调用远程库存服务。
 * 该接口定义了与库存相关的操作，如检查库存、预留库存、释放预留库存和减少库存。
 */
@FeignClient(name = "beauty-inventory", path = "/api/inventory")
public interface InventoryClient {
    
    @GetMapping("/product/{productId}")
    Result<?> checkProductInventory(@PathVariable("productId") String productId);
    
    @PutMapping("/product/{productId}/reserve")
    Result<?> reserveStock(@PathVariable("productId") String productId, @RequestParam("quantity") Integer quantity);
    
    @PutMapping("/product/{productId}/release")
    Result<?> releaseReservedStock(@PathVariable("productId") String productId, @RequestParam("quantity") Integer quantity);
    
    @PutMapping("/product/{productId}/reduce")
    Result<?> reduceStock(@PathVariable("productId") String productId, @RequestParam("quantity") Integer quantity);
} 